<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // apply(this指向, 数组)
        var p = {};

        function fn(x, y) {
            console.log(this);
            console.log(x + y);
        };
        fn.apply(p, [1, 2]);
        // 因为apply()第二个参数是传递数组元素，所以可以利用来算数组中的数字最大最小
        var num = [1, 2, 3, 4, 5, 6, 22, 11];;
        console.log(Math.max.apply(Math, num));
    </script>
</body>

</html>